﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ProductService;
using System.Web.Services.Protocols;

public partial class DemoWS : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        try
        {
            MyServiceName service = new MyServiceName();

            service.GetAllInfoHeaderValue = new GetAllInfoHeader();
            service.GetAllInfoHeaderValue.Flag = false;
            ProductService.Product p = service.GetProductByPrimaryKey(int.Parse(TextBox1.Text));
            

            // Working other job
            //Thread.Sleep(10000);

            // Back
            Label2.Text = p.ProductName;
        }
        catch (WebException we)
        {
            Label2.Text = "Lỗi mạng";
        }
        catch(SoapException se)
        {
            Label2.Text = se.Message;
            Label3.Text = se.Code.Name;
        }

    }
}